﻿using DevExpress.Utils.Taskbar;
using Model;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using 后整理管理系统.自定义类;
using 纺织贸易管理系统;
using 纺织贸易管理系统.设置窗体;

namespace 后整理管理系统.其他窗体
{
    public partial class 查看细码 : Sunny.UI.UIForm
    {
        private List<danjumingxitable> danjumingxitables;
        public 查看细码(List<danjumingxitable> mingxis)
        {
            InitializeComponent();
            CreateGrid.Create("打卷报表", gridView2);
            danjumingxitables =mingxis;
            gridControl2.DataSource = GetRolls(mingxis);
        }
        private List<JuanHaoTable> GetRolls(List<danjumingxitable> danjumingxitables)
        {
            var rolls=new List<JuanHaoTable>();
            foreach (var item in danjumingxitables)
            {
                rolls.AddRange(Connect.dbcontext.Queryable<JuanHaoTable>().Where(x => x.ReceiptNo == item.danhao && x.GangHao == item.ganghao && x.yanse == item.yanse).ToList());
            }
            return rolls;
        }

        private void 编辑报告ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (后整理管理系统.自定义类.PrintService.CheckPrintDesignAccess())
            {
                Tools.打印检验报告.PrintReport(PrintModel.Design, SelectHelper.CreatJuanhao(gridView2));
            }
        }

        private void 预览报告ToolStripMenuItem_Click(object sender, EventArgs e)
        {           
                Tools.打印检验报告.PrintReport(PrintModel.Privew, SelectHelper.CreatJuanhao(gridView2));
        }

        private void 打印报告ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Tools.打印检验报告.PrintReport(PrintModel.Print, SelectHelper.CreatJuanhao(gridView2));
        }

      
    }
}
